home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Archive / Graphics / QuickDraw GX / GX->PostScript Sample / GXToPostScript / I⁄O Utilities / RDUtil.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  3.7 KB  |  113 lines  |  [TEXT/MPS ]

  1.  
  2. /*
  3.      File:        RDUtil.h
  4.  
  5.      Contains:    QuickDraw GX to PostScript conversion code.
  6.                          This file contains definitions necessary for the Resource Dump Utilities.
  7.  
  8.      Version:    Technology:    Quickdraw GX 1.1.x
  9.       
  10.      Copyright:    © 1995-1997 by Apple Computer, Inc., all rights reserved.
  11. */
  12.  
  13. #ifndef __RESDUMPUTILS__
  14. #define __RESDUMPUTILS__
  15.  
  16. #include <Types.h>
  17. #include "GXPrintingUniverse.h"
  18.  
  19. //#include <NumberFormatting.h>
  20.  
  21.  
  22. typedef long TRDFlags;
  23.  
  24. /** the eRDMakeHex flag is in the same bit position as eBuffMakeHex, this makes RD code better **/
  25.  
  26. #define        eRDnoOptions        (TRDFlags)0x00L
  27. #define        eRDMakeHex            (TRDFlags)0x01L
  28. #define        eRDCharSubs            (TRDFlags)0x02L
  29. #define        eRDNoAutoFlush    (TRDFlags)0x04L            
  30.  
  31.  
  32.  
  33.  
  34. #define kRDBufferSize 1024
  35.  
  36. /*** The data structure for the Resource Dump Utility map record ***/
  37.  
  38. typedef struct {
  39.  
  40.     CGXtoPostScriptDevice        *psDevice;            // Buffer Map for sending data.  Allocated by GBAllocateBuffers;
  41.  
  42.     /* These parameters are used for caching resource information */
  43.     Handle                hLastResource;            //    Handle to the last resource loaded in by ResPrintf.
  44.     short                    lastResID;                    //    ID of last resource loaded in by ResPrintf.
  45.     OSType                lastResType;                //    type of the last resource loaded in by ResPrintf.
  46.     short                    lastResRef;                    //    Refnum of the resource file that the last resource was from.
  47.     short                    lastResIndex;                //    Index of the last requested string in the resource.
  48.     long                    lastOffset;                    //    Byte offset into resource of the last requested string.
  49.  
  50.     /** These fields are for character substitution
  51.             See block comment below for explination of substitution data structures **/
  52.     short                    nSubs;                            //    How many substitution specifications there are.
  53.     Handle                hCharSubstitute;        //    Handle to the string substitution array.
  54.     unsigned char    subsBits[32];                //    substitution character bit array for speedy checking.
  55.     
  56.     /** Misc. fields **/
  57.     char                    xySep;                            //    Character to output between the x and y of a point.
  58.     
  59.     /** Buffering fields. **/
  60.     
  61.     short                    buffPtr;
  62.     char                    buffer[kRDBufferSize];
  63.  
  64. } TRDMapRec;
  65.  
  66. typedef TRDMapRec *TRDMapPtr, **TRDMapHdl;
  67.  
  68. /***************************************************
  69.  
  70.     The structure of the substitution array:
  71.     
  72.         The first byte is the character to substitute, the next byte is the 
  73.         length of the string to substitute it with, and then the substitution string
  74.         itself, this pattern repeats for the number of substitutions.
  75.         
  76.         The substitution bits is an array of 256 bits.  For each character
  77.         that must be substituted, the bit with the index of the ascii value
  78.         of the character is set in the array.  This facilitates quick checking
  79.         of characters to see if they need substitution.  Then, only if they
  80.         need it, we search the substitution array for the pascal-string to 
  81.         substitute it with.
  82.         
  83. *****************************************************/
  84.  
  85. /******
  86.     This is the parameter block for RDResPrintf and its kin.
  87.     
  88. *******/
  89.  
  90. typedef struct {
  91.  
  92.     TRDMapHdl            rdMap;                        // Client's map.
  93.     OSType                resType;                    // resource type to load
  94.     short                    resID;                        // resource ID to load.
  95.     short                    resIndex;                    // indexed string index into resource (used ony by resprintf)
  96.     TRDFlags            rdFlags;                    // Buffering flags.
  97.  
  98. } TRDParams;
  99.  
  100. /***************************  Externally referenced Function prototypes *************************/
  101.  
  102. OSErr    RDInit(CGXtoPostScriptDevice *psDevice, TRDMapHdl *rdMap);
  103. OSErr RDShutdown(TRDMapHdl rdMap);
  104. OSErr RDResPrintf(TRDParams *params, ...);
  105. OSErr RDResBDump(TRDParams *params);
  106. OSErr RDSetSubstitutions(TRDMapHdl rdMap, long nSubs, ...);
  107. OSErr RDResStrListDump(TRDParams *params, char *termString);
  108. OSErr RDSetXYSep(TRDMapHdl rdMap, char theChar);
  109. OSErr    RDInvalResCache(TRDMapHdl rdMap);
  110. OSErr    RDFlushBuffer(TRDMapHdl rdMap);
  111.  
  112. #endif // __RESDUMPUTILS__
  113.